package com.zhongge.service.impl;

import ch.qos.logback.classic.spi.EventArgUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongge.entity.Student;
import com.zhongge.mapper.StudentMapper;
import com.zhongge.service.IStudentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongge.vo.StudentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhongge
 * @since 2025-11-09
 */
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements IStudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public IPage<StudentVO> getStudentPage(Integer page, Integer size, String name, String studentNumber, Long classId) {
        Page<StudentVO> pageParam = new Page<>(page, size);
        return studentMapper.selectStudentPage(pageParam, name, studentNumber, classId);
    }

    @Override
    public IPage<StudentVO> getStudentByClassID(Integer page, Integer size,Integer id) {
        Page<StudentVO> pageParam = new Page<>(page, size);
        return studentMapper.getStudentByClassID(pageParam,id);
    }

    @Override
    public Student login(String studentNumber, String password) {
        QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("password",password);
        return studentMapper.selectOne(queryWrapper);
    }
}
